package com.race.entities.po;

import com.race.entities.po.Base.AbstractEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.List;
import java.util.Set;

@Getter
@Setter
@Entity
public class Role extends AbstractEntity {
    /**
     * 角色标识
     */
    private String name;
    /**
     * 描叙
     */
    private String description;

    /**
     * 角色----权限
     */
    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(joinColumns = {@JoinColumn(name = "rid")},
                inverseJoinColumns = {@JoinColumn(name = "pid")})
    private Set<Permission> permissions;

    @ManyToMany
    @JoinTable(joinColumns = {@JoinColumn(name = "rid")},
                inverseJoinColumns = {@JoinColumn(name = "uid")})
    private Set<User> users;
}
